package com.zhq.blog.manage.domain.controller.system;



import javax.validation.Valid;

import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;

import com.zhq.blog.core.domain.system.HoldId;
import com.zhq.blog.manage.domain.controller.BaseController;
import com.zhq.blog.manage.domain.controller.BossModel;

@Controller
@Scope("prototype")
@RequestMapping("/admin/system/holdId/*")
public class HoldIdController extends BaseController {
	@RequestMapping(value="add")
	public BossModel add(){
		return createModel("admin/system/holdId/info").add("holdId",context.getHoldIdRepository().findAll().get(0));
	}
	
	@RequestMapping(value="save",method = RequestMethod.POST)
	public BossModel save(@Valid final HoldId holdId, final BindingResult bindingResult, final ModelMap model, RedirectAttributes redirectPrizes){
		context.getHoldIdRepository().save(holdId);
		return createModel("admin/system/holdId/info").add("holdId",context.getHoldIdRepository().findAll().get(0));
	}

}
